//
//  MainTabBarController.m
//  iosTestDemo
//
//  Created by 商广硕 on 2022/7/3.
//

#import "MainTabBarController.h"
#import "HomeViewController.h"
#import "SetViewController.h"


@interface MainTabBarController ()

@end

@implementation MainTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    //创建tabbarController中每一个tab对应的要显示的对象，就是子视图
    HomeViewController *homeVC= [[HomeViewController alloc]init];
    SetViewController *setVC = [[SetViewController alloc]init];
    //将tab对应的对象添加到UITabBarController中
    [self setViewControllers:@[homeVC,setVC]];
    

    UITabBar *tabBar = self.tabBar;
    UITabBarItem *item1=[tabBar.items objectAtIndex:0];
    item1.title=@"首页";
    UITabBarItem *item2=[tabBar.items objectAtIndex:1];
    item2.title=@"设置";
    tabBar.unselectedItemTintColor=[UIColor orangeColor];//设置未选择的字体颜色
    tabBar.tintColor=[UIColor redColor];////设置选中的字体颜色
    item1.image=[[UIImage imageNamed:@"tab_home"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    item1.selectedImage=[[UIImage imageNamed:@"tab_home_select"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    //设置未选中的图片
    item2.image=[[UIImage imageNamed:@"tab_home"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    //设置选中的图片
    item2.selectedImage=[[UIImage imageNamed:@"tab_home_select"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    self.view.backgroundColor = [UIColor whiteColor];
//    CGRect tabFrame = tabBar.frame; //self.TabBar is IBOutlet of your TabBar
//        tabFrame.size.height = 180;
//        tabFrame.origin.y = self.view.frame.size.height - 80;
//    tabBar.frame = tabFrame;
    tabBar.backgroundColor =[UIColor whiteColor];
   
    

}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
